Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Temporal.Duration.p*.abs #3062

Closed
wants to merge 3 commits into from

Conversation

FrankYFTang
Copy link
Contributor

features: [Temporal]
---*/

function assertDuration(duration, years, months, weeks, days, hours,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using TemporalHelpers.assertDuration.

@FrankYFTang
Copy link
Contributor Author

Update the test to use temporalHelpers.js and add test for throw. But I cannot find a condiction to cause CreateTemporalDuration to throw @jugglinmike

@FrankYFTang
Copy link
Contributor Author

@FrankYFTang
Copy link
Contributor Author

ok, let me just abandon this PR and wait for @ptomato and @Ms2ger to move their test from Temporal repo instead.

@FrankYFTang FrankYFTang closed this Aug 9, 2021
ptomato pushed a commit to ptomato/test262 that referenced this pull request Mar 19, 2022
(Philip, March 2022: This was originally Frank's PR tc39#3062. I did some
reformatting and removed duplicate tests)
ptomato pushed a commit to ptomato/test262 that referenced this pull request Mar 19, 2022
(Philip, March 2022: This was originally Frank's PR tc39#3062. I did some
reformatting and removed duplicate tests)
rwaldron pushed a commit that referenced this pull request Mar 29, 2022
(Philip, March 2022: This was originally Frank's PR #3062. I did some
reformatting and removed duplicate tests)
jessealama pushed a commit to jessealama/test262 that referenced this pull request Apr 13, 2022
(Philip, March 2022: This was originally Frank's PR tc39#3062. I did some
reformatting and removed duplicate tests)
jessealama pushed a commit to jessealama/test262 that referenced this pull request Apr 13, 2022
(Philip, March 2022: This was originally Frank's PR tc39#3062. I did some
reformatting and removed duplicate tests)
jessealama added a commit to jessealama/test262 that referenced this pull request Apr 15, 2022
commit 1c19242
Author: Shu-yu Guo <[email protected]>
Date:   Wed Apr 13 14:06:45 2022 -0700

    Remove check for per-iteration detach check in TypedArray.prototype.set

    Note that this test currently unintentionally passes, because a
    TypeError is thrown for failing to convert the undefined returned from
    the getter to a BigInt. But since this test was intended to test
    detaching, it's no longer valid and should still be removed.

    See tc39#3465 (comment)

commit 4dafd21
Author: Ms2ger <[email protected]>
Date:   Wed Apr 13 15:02:27 2022 +0200

    Temporal: Remove some stray arguments to TemporalHelpers.assertDuration.

commit c35ae20
Author: Ms2ger <[email protected]>
Date:   Wed Apr 13 18:31:57 2022 +0200

    Temporal: Some more tests for PlainDateTime#with. (tc39#3481)

commit d9616ed
Author: Philip Chimento <[email protected]>
Date:   Fri Apr 8 16:30:39 2022 -0700

    Add tests for direction of rounding functionality

    The round() and toString() methods of Temporal.Instant, PlainDateTime, and
    ZonedDateTime can round up or down. However, the instance must not be
    treated as "negative" even when the time is before 1 BCE (years are
    negative) or before the Unix epoch (epoch nanoseconds are negative). That
    is, rounding down is always towards the Big Bang, and rounding up is
    always away from it. Add tests that verify this.

commit 3905c0c
Author: Philip Chimento <[email protected]>
Date:   Fri Apr 8 11:39:40 2022 -0700

    Expand toString() rounding tests from PlainTime to cover other types

    This takes the tests of the rounding functionality of
    Temporal.PlainTime.p.toString() and adds similar tests covering the
    equivalent functionality to Duration, Instant, PlainDateTime, and
    ZonedDateTime: all the types that have rounding and precision controls
    for how they output their subsecond values.

    It also takes the opportunity to improve the existing PlainTime tests:

    - fractionalseconddigits-auto.js: More descriptive variable names. Added
      assertion messages.
    - fractionalseconddigits-number.js: Ditto.
    - rounding-cross-midnight.js: Use constructor directly to remove coupling
      with from().
    - roundingmode-*.js: Add additional tests for specifying the precision
      using fractionalSecondDigits.
    - smallestunit-fractionalseconddigits.js: Add assertion messages.

commit 4ac16c2
Author: Philip Chimento <[email protected]>
Date:   Fri Apr 8 10:52:39 2022 -0700

    Add tests for Temporal options bags being of the wrong type

    This consolidates the few existing tests for options bags in Temporal
    being of the wrong type, and adds them for every entry point in Temporal
    that accepts an options bag.

    These are mostly identical tests, but there is a variation for methods
    like round() where either an options bag or string is accepted.

commit 9f30311
Author: Philip Chimento <[email protected]>
Date:   Thu Apr 7 18:32:15 2022 -0700

    Repeat Instant.p.toString() test with timeZone parameter for IANA time zones

    This adds to the intl402/ tree a copy of
    built-ins/Temporal/Instant/prototype/toString/timezone-offset.js but which
    uses IANA time zones.

commit 9b2c98c
Author: Philip Chimento <[email protected]>
Date:   Thu Apr 7 18:27:47 2022 -0700

    Bring existing "invalid string" tests for smallestUnit and largestUnit in sync

    Add a consistent set of invalid strings for all of the
    smallestunit-invalid-string.js and largestunit-invalid-string.js tests:
    - "era" and "eraYear" in singular and plural
    - all of the units that are disallowed for that particular method call, in
      singular and plural
    - an allowed unit with \0 at the end
    - an allowed unit with an "i" replaced by a dotless i
    - an allowed unit but with all-caps
    - an unrelated string.

commit b4c0aed
Author: Philip Chimento <[email protected]>
Date:   Thu Apr 7 16:54:51 2022 -0700

    Bring existing toString options tests in sync with each other

    Of the toString() methods that have options for printing a time with
    seconds and fractional seconds, PlainTime seems to have the most
    comprehensive set of tests. Bring all the others (Duration, Instant,
    PlainDateTime, and ZonedDateTime) in sync with PlainTime, and edit the
    PlainTime ones where necessary to include improvements from the others.

    Tests:
      - fractionalseconddigits-invalid-string.js: copy and expand on
        PlainTime's more comprehensive set of invalid strings. Add assertion
        message. Fix front matter.
      - fractionalseconddigits-non-integer.js: Fix front matter.
      - fractionalseconddigits-out-of-range.js: make sure infinity is tested.
        Add assertion messages. Fix front matter.
      - fractionalseconddigits-undefined.js: copy PlainTime's more
        comprehensive test with whole minutes, whole seconds, and subseconds.
        Copy PlainTime's test of an empty function object. Add more
        descriptive variable names and assertion messages. Fix front matter.
      - fractionalseconddigits-wrong-type.js: inline and delete TemporalHelper
        used here; it was only good for this test anyway. Improve assertion
        messages.
      - smallestunit-valid-units.js: copy PlainTime's test with a second value
        with zero seconds even. Refactor repetitive tests into a loop. Copy
        the invalid unit "era" from the Instant test. Add assertion messages.

commit 2c880bf
Author: Ms2ger <[email protected]>
Date:   Tue Apr 12 11:34:57 2022 +0200

    Temporal: Some more tests for PlainDateTime.compare.

commit a226601
Author: Ms2ger <[email protected]>
Date:   Tue Apr 12 17:32:18 2022 +0200

    Temporal: Some more tests for PlainDateTime#withPlainDate.

commit 7823be3
Author: Ms2ger <[email protected]>
Date:   Tue Apr 12 17:21:24 2022 +0200

    Temporal: Move test with typo in name.

commit 62e0130
Author: Ms2ger <[email protected]>
Date:   Tue Apr 12 19:02:53 2022 +0200

    Temporal: Some more tests for PlainDateTime#equals. (tc39#3479)

commit 5f1aba6
Author: Jesse Alama <[email protected]>
Date:   Tue Apr 12 17:36:03 2022 +0200

    Temporal: Port Demitasse PlainDateTime `round` tests (tc39#3478)

    Co-authored-by: Ms2ger <[email protected]>

commit 9055521
Author: rwaldron <[email protected]>
Date:   Mon Apr 11 13:08:37 2022 -0400

    ShadowRealm: fix for incorrect test

commit d4ede37
Author: Mike Pennisi <[email protected]>
Date:   Fri Apr 8 20:37:17 2022 -0400

    Add assertions for functions with infinite length

    A prior version of ECMA262 described invalid mathematical operations
    with infinite values [1]. Update the test metadata to reflect the
    corrected specification text, and add two assertions for the obsolete
    conditions.

    [1] ".bind on a function with infinite length has imprecise spec and
        engine divergences"
        tc39/ecma262#2170

commit 24e4eb0
Author: rwaldron <[email protected]>
Date:   Mon Apr 11 10:16:36 2022 -0400

    ShadowRealm: add more tests for globalThis ordinary object conformance

commit d7c0a20
Author: Shu-yu Guo <[email protected]>
Date:   Mon Apr 4 16:36:56 2022 -0700

    Remove check for per-comparator call detach check in TypedArray.prototype.sort

    This updates tests in line with the normative change in
    tc39/ecma262#2723

commit 3ac6b73
Author: Shu-yu Guo <[email protected]>
Date:   Mon Apr 4 16:42:58 2022 -0700

    Add test that TypedArray.prototype.set doesn't throw if a getter for an element detaches

commit 8b29141
Author: Shu-yu Guo <[email protected]>
Date:   Mon Apr 4 15:44:22 2022 -0700

    Remove check for per-iteration detach check in TypedArray.prototype.set

    This updates tests in line with the normative change in
    tc39/ecma262#2646

commit f60d7cf
Author: rwaldron <[email protected]>
Date:   Tue Apr 5 11:18:45 2022 -0400

    fixup! Fix false negative in for-in test

commit 384a4e1
Author: rwaldron <[email protected]>
Date:   Tue Apr 5 11:18:10 2022 -0400

    Fix false negative in for-in test

    As originally written, this test would spuriously pass when the deleted
    property was incorrectly visited by enumation but correctly removed from
    the object. In such cases, the accumulator string would take the form

        "aa1baundefinedca3"

    And satisfy all conditions intended to highlight implementation errors.

    Refactor the test to avoid false negative by using an object with a null
    prototype and verifying the exact contents of the accumulator string.

commit 3c88e9b
Author: Mike Pennisi <[email protected]>
Date:   Fri Apr 1 18:16:06 2022 -0400

    Fix false negative in for-in test

    As originally written, this test would spuriously pass when the deleted
    property was incorrectly visited by enumation but correctly removed from
    the object. In such cases, the accumulator string would take the form

        "aa1baundefinedca3"

    And satisfy all conditions intended to highlight implementation errors.

    Refactor the test to avoid false negative by using an object with a null
    prototype and verifying the exact contents of the accumulator string.

commit 833a784
Author: Philip Chimento <[email protected]>
Date:   Thu Mar 31 18:16:17 2022 -0700

    Tests for computing PlainYearMonth addition and subtraction in correct calendar space

    tc39/proposal-temporal#2003 is a normative change
    that reached consensus at the March 2022 TC39 plenary meeting. This adds
    tests that verify the new spec text is implemented correctly, performing
    arithmetic on a PlainYearMonth instance that would previously have thrown
    an error if it was implemented as written.

commit c58ac69
Author: Richard Gibson <[email protected]>
Date:   Fri Mar 25 08:35:50 2022 -0400

    Test that "infinity" is not recognized as numeric

commit c572588
Author: Richard Gibson <[email protected]>
Date:   Thu Mar 24 16:52:05 2022 -0400

    Test that "INFINITY" is not recognized as numeric

    Fixes tc39#3442

commit 51822ff
Author: Shu-yu Guo <[email protected]>
Date:   Thu Mar 31 16:37:06 2022 -0700

    Update Symbol.species tests for TypedArray constructor

    This updates tests in line with
    tc39/ecma262#2719

commit da507a7
Author: Philip Chimento <[email protected]>
Date:   Thu Mar 31 12:36:06 2022 -0700

    Tests for Temporal formatting the year appropriately as 4 or 6 digits

    tc39/proposal-temporal#2090 is a normative change
    that reached consensus at the March 2022 TC39 plenary meeting. This adds
    tests that verify the change made to the formatting of years between 0 and
    999 inclusive in all toString and toJSON methods of Temporal types that
    can output an ISO year number in their return value.

commit cdcf2a3
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 11:50:58 2021 -0700

    Add tests for Temporal.Calendar.p*.inLeapYear

    (Philip, March 2022: This was originally Frank's PR tc39#3056. I did some
    reformatting, removed duplicate tests, and combined with some existing
    tests.)

commit 16aefcc
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 12:08:18 2021 -0700

    Add tests for Temporal.Calendar.p*.mergeFields

    (Philip, March 2022: This was originally Frank's PR tc39#3057. I did some
    reformatting, removed duplicate tests, addressed the review comments that
    I left the first time around, and added some cases that I felt were not
    yet complete.)

commit 6bae30c
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 13:31:55 2021 -0700

    Add tests for Temporal.Calendar.p*.monthDayFromFields

    (Philip, March 2022: This was originally Frank's PR tc39#3058. I did some
    reformatting, removed duplicate tests, and combined with some existing
    tests.)

commit c22b8ab
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 13:45:21 2021 -0700

    Add tests for Temporal.Calendar.p*.monthsInYear

    (Philip, March 2022: This was originally Frank's PR tc39#3059. I did some
    reformatting, removed duplicate tests, and combined with some existing
    tests.)

commit b064eb6
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 14:00:42 2021 -0700

    Add tests for Temporal.Calendar.p*.weekOfYear

    (Philip, March 2022: This was originally Frank's PR tc39#3060. I did some
    reformatting, removed a test that didn't exercise the whole feature, and
    combined some duplicate tests with some existing tests.)

commit ac19506
Author: Philip Chimento <[email protected]>
Date:   Tue Feb 1 15:38:24 2022 -0800

    Add tests ensuring that observable calls are made with options === undefined

    Where possible, observable calls originating from within Temporal, that
    require an options argument, should pass `undefined` as that options
    argument, rather than `{}` or `Object.create(null)`.

    See tc39/proposal-temporal#1685.

commit 16ad841
Author: Philip Chimento <[email protected]>
Date:   Wed Feb 2 16:42:53 2022 -0800

    Fix arithmetic in TemporalHelpers.oneShiftTimeZone

    I made a mistake with one of the signs in one of the time zones that we
    use for verifying DST handling. Luckily this didn't affect any previously
    existing tests, but it affected some new tests that I'm going to add in
    the next commit.

    How do I know that _this_ arithmetic is correct? I feel reasonably
    confident with the added test.

commit 276e79d
Author: Mike Pennisi <[email protected]>
Date:   Fri Mar 25 19:47:14 2022 -0400

    Deprecate some property helpers

    Document the preference for `verifyProperty` over the various other
    property-related helper functions.

commit 5eb7dfb
Author: jugglinmike <[email protected]>
Date:   Mon Apr 4 11:27:22 2022 -0400

    Remove configuration file for third-party tool (tc39#3450)

    The `.jshintrc` file configures the JavaScript "linting" tool named
    JSHint. Test262 does not depend on that tool, making the file's purpose
    and validity ambiguous and potentially distracting.

commit 926b096
Author: Romulo Cintra <[email protected]>
Date:   Thu Mar 31 23:53:20 2022 +0200

    update nfv3 test for roundingIncrement (tc39#3441)

commit 4c7c246
Author: Jesse Alama <[email protected]>
Date:   Wed Mar 30 17:33:52 2022 +0200

    Check a variety of offset Etc/GMT timezones (tc39#3403)

    Tests for normative change tc39/proposal-temporal#2050

commit fe40aea
Author: Jesse Alama <[email protected]>
Date:   Mon Feb 21 14:14:44 2022 +0100

    Emit fallback day 1

commit 9aaa22c
Author: Jesse Alama <[email protected]>
Date:   Mon Feb 21 14:06:52 2022 +0100

    Ensure fallback years values are present

commit ee1f962
Author: Jesse Alama <[email protected]>
Date:   Fri Feb 4 08:50:10 2022 +0100

    Ensure reference data is emitted when calendarName = 'always'

    References:

    + tc39/proposal-temporal#1971

commit 76b0baf
Author: Jesse Alama <[email protected]>
Date:   Fri Feb 11 09:21:10 2022 +0100

    Update test/built-ins/Temporal/Duration/compare/twenty-five-hour-day.js

    Co-authored-by: Philip Chimento <[email protected]>

commit 2aa754b
Author: Jesse Alama <[email protected]>
Date:   Thu Feb 3 11:54:45 2022 +0100

    Add test for DST balancing

    References:

    + tc39/proposal-temporal#1791

    Thanks @ptomato for the suggestion to use
    `springForwardFallBackTimeZone`.

commit 3ab8adc
Author: Richard Gibson <[email protected]>
Date:   Wed Mar 23 00:17:23 2022 -0400

    Require String.prototype.localeCompare to check for canonical equivalence

commit 3eea1a7
Author: Philip Chimento <[email protected]>
Date:   Thu Mar 24 16:37:19 2022 -0700

    Add tests for various invalid ISO strings for PlainDate

    These tests check API entry points that convert strings to
    Temporal.PlainDate, with a list of various strings that are all not valid
    for that context according to ISO 8601.

commit ad74a4e
Author: Philip Chimento <[email protected]>
Date:   Thu Mar 24 16:32:06 2022 -0700

    Rename some "argument-string" tests to be more specific

    I'd like to add basic functionality tests for string arguments, and these
    tests are testing something more specific: that a Get of the "overflow"
    property on the passed-in options object is observable. Rename
    accordingly.

commit 52af2b6
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 14:26:11 2021 -0700

    Add tests for Temporal.Calendar.p*.yearMonthFromFields

    (Philip, March 2022: This was originally Frank's PR tc39#3061. I did some
    reformatting, removed duplicate tests, and combined with some existing
    tests.)

commit 0bad719
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 14:50:02 2021 -0700

    Add test for Temporal.Duration.p*.abs

    (Philip, March 2022: This was originally Frank's PR tc39#3062. I did some
    reformatting and removed duplicate tests)

commit f23602f
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 14:59:43 2021 -0700

    Add test for Temporal.Duration.p*.negated

    (Philip, March 2022: This was originally Frank's PR tc39#3063. I did some
    reformatting and removed duplicate tests)

commit b8af7ff
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 15:10:08 2021 -0700

    Add test for Temporal.Duration.p*.toJSON

    (Philip, March 2022: This was originally Frank's PR tc39#3064. I did some
    reformatting and removed duplicate tests)

commit 2c8b69f
Author: Frank Tang <[email protected]>
Date:   Mon Jul 19 15:32:37 2021 -0700

    Add tests for Temporal.Duration.p*.with

    (Philip, March 2022: This was originally Frank's PR tc39#3065. I did some
    reformatting, removed duplicate tests, and combined with some existing
    tests.)

commit f59bafa
Author: Iban Eguia Moraza <[email protected]>
Date:   Mon Mar 28 21:22:05 2022 +0200

    Fixed YAML in some new test metadata

commit 99b2a70
Author: Jesse Alama <[email protected]>
Date:   Sat Mar 26 01:13:17 2022 +0100

    Use ECMAScript version 11 (tc39#3448)

    We use BigInt syntax in a bunch of tests. This change
    registers that fact with linters that use `.jshintrc`.

commit f964584
Author: Ms2ger <[email protected]>
Date:   Fri Mar 25 13:25:54 2022 +0100

    Expand overflow-invalid-string.js tests.
@FrankYFTang FrankYFTang deleted the durationAbs branch July 21, 2022 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants